#include "stdafx.h"
#include "RemindItem.h"

#include <QFile>
#include <QDesktopServices>

RemindItem::RemindItem(QWidget *parent)
: QWebEngineView(parent)
{
	setPage(new RemindWebPage());
	connect(page(), SIGNAL(openUrl(const QUrl &)), this, SLOT(openUrl(const QUrl &)));
}

RemindItem::~RemindItem()
{
	disconnect(page(), SIGNAL(openUrl(const QUrl &)), this, SLOT(openUrl(const QUrl &)));
}

void RemindItem::openUrl(const QUrl & url)
{
	QString strURL = url.url();
	if (strURL.startsWith("HTTP", Qt::CaseInsensitive))
	{
		QDesktopServices::openUrl(url);
		emit hideWidget();
	}
}
